package com.bhy702.generator.builder.factory.codeImpl;

import com.bhy702.generator.builder.TplProperties;
import com.bhy702.generator.builder.util.GenerateUtil;
import com.bhy702.generator.builder.factory.Code;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import java.io.IOException;


/**
 * @author: brbai
 * @create: 2019-12-14 19:12:59
 * @description:
 */
public class Entity implements Code {

    @Override
    public void create(GroupTemplate gt, TplProperties properties, String tplPath) throws IOException {

        String packageName =  properties.getRootPackage()+ ".entity";
        properties.setParam("packageName",packageName);

        Template t = gt.getTemplate(tplPath);
        t.binding("props", properties);

        GenerateUtil.createFile(t,properties.getBasePath()+"/main/java/"
                + packageName.replace(".", "/") + "/" + properties.getClassName() + ".java");
    }
}
